using BuildingBlocks.Abstractions.EventBase;
using Identity.Application.Contracts.Events;
using Identity.Application.Contracts.Services;

namespace Identity.Infrastructure.EventHandlers;

public class SendCodeEmailWithResetPasswordEventHandler : IIntegrationEventHandler<SendCodeEmailWithResetPasswordEvent>
{
    private readonly IEmailService _emailservice;
    public SendCodeEmailWithResetPasswordEventHandler(IEmailService emailservice)
    {
        _emailservice = emailservice;
    }
    public async Task HandleAsync(SendCodeEmailWithResetPasswordEvent @event)
    {
        await _emailservice.SendEmailAsync(@event.email, "重置密码验证码", $"验证码是：{@event.code}");
    }
}